package top.wardyan.wbaseswt.control;

import org.eclipse.swt.widgets.Composite;

import top.wardyan.wbaseswt.conf.Const;

public class WComposite extends Composite{

	public WComposite(Composite parent, int style) {
		super(parent, style);
		this.createContent();
	}
	
	/**
	public WComposite(Composite parent, int style, int x, int y, int width, int height, Color background) {
		this(parent, style);
		this.setBounds(x, y, width, height);
		this.setBackground(background);
	}
	
	public WComposite(Composite parent, int x, int y, int width, int height) {
		this(parent, SWT.NONE, x, y, width, height, Const.COLOR_WHITE);
	}
	
	public WComposite(Composite parent, int style, Color background) {
		this(parent, style);
		//this.setBounds(x, y, width, height);
		this.setBackground(background);
	}
	**/
	private void createContent() {
		this.setBackground(Const.COLOR_WHITE);
		this.setForeground(Const.COLOR_BLACK);
	}
	
	@Override
	protected void checkSubclass() {}
	
	/**
	 * 取得控件右下角的定点的x
	 * @return
	 */
	public int getVertexX() {
		return this.getLocation().x + this.getSize().x;
	}
	/**
	 * 取得控件右下角的定点的y
	 * @return
	 */
	public int getVertexY() {
		return this.getLocation().y + this.getSize().y;
	}

}
